<?php
echo"<table><tr><td colspan='3'>&nbsp;</td></tr>";
	echo"<tr><td colspan='3' class='judul'>&#187 Result Jenis Obat</td></tr>";
	echo"<tr><td colspan='3' class='jarak_garis'><hr color='#6d6a69'>&nbsp;</hr></td></tr></table>";
$key=$_POST["key"];
$field=$_POST['field'];

$query=dbQuery("select * from tbjenis where tbjenis.$field like'%$key%' order by id_jenis");
$baris=dbRows($query);
 echo "<tr><td valign='top' colspan='2' class='judul'><div align='center'>Result : <font color='red'>$baris	</font> item</td></tr>";
	if($baris>0){
	
	$batas_data=20;
	$page=$_GET['page'];
		if(empty($page)){
			$posisi=0;
			$page=1;
			
		}else{
		$poisi=($page-1)*$batas_data;
		}
		?>
		<table width="100%" border="0" cellpadding="3" cellspacing="1" align="center" class="tabel">
		<tr> 
    		
  		</tr>
		
		 
		<tr bgcolor="#1085ac">
    	<td  colspan="4" height="20" ><span class="title_atas">ResultJenis</span> 
		</td>
			
			
			
		  	</tr>
	<tr class="title_atas" bgcolor="#0ab3eb" align="center">
		<td width="5%" align="center">ID Jenis</td>
		<td width="20%">Nama Jenis</td>
		
		
		<td width="2%" colspan="2" >Action</td>
		
	</tr>
	<?php
	
		$urutan = 1;
	while($data=dbAssoc($query)){
		if($urutan% 2 == 0) {
				$bgcolor	=	"#5ad1f4";
			} else {
				$bgcolor	=	"#FFFFFF";
	}
	
	
	?>
	
	<tr class="list_admin" align="center" bgcolor="<?php print $bgcolor; ?>">
		<td width="5%" align="center" ><?php print $data['id_jenis']; ?></td>
		<td width="20%" align="center" ><?php print $data['nama_jenis']; ?></td>
		
				
	
    		
			
			<td><a href="<?php echo "index_admin.php?index=edit_jenis&id_jenis=$data[id_jenis]&cryption=$encode.*upn*.$santra.$random"; ?>"> <img src="../picture/edit.png" width="15" height="15" border="0" /></a></td>
			
		<td><a onClick="<?php echo "return confirm('Are You Sure to delete it $data[nama_jenis] ?')"; ?>" href="<?php echo "index_admin.php?index=delete_jenis&id_jenis=$data[id_jenis]&cryption=$encode.*upn*.$santra.$random"; ?>"><img src="../picture/delete.gif" width="15" height="15" border="0" /></a></td>
	</tr>
	
	
	<?php $urutan ++;
}
	
	?>
	
	
	
	
	
	<?php
	
	
	echo "<tr><td colspan='9'>&nbsp;</td></tr>";
	echo "<tr><td colspan='9'><div align='center' id='pagging'>";
	$sql	=	"select * from tbjenis order by id_jenis   ";
	$query3	=	dbQuery($sql);

	$baris	=	dbRows($query3);
	$jumlahhalaman			=	ceil($baris/$batas_data);
	$file_place				=	"index_pegawai.php?index=search_jenis&cryption=$encode.*phb*.$phb.$random";
	if ($page > 1) {
		$previous			=	$page - 1;
		echo "<a href='$file_place&page=1'><< First</a> | <a href='$file_place&page=$previous'>< Previous</a> | ";
	} else {
		echo "<< First | < Previous | ";
	}
	for($ifa=1; $ifa<=$jumlahhalaman; $ifa++) {
		if($ifa != $page) {
			echo " <a href='$file_place&page=$ifa'>$ifa</a> | ";
		} else {
			echo " <strong>$ifa</strong> | ";
		}
	}
	if($page < $jumlahhalaman) {
		$next				=	$page + 1;
		echo "<a href='$file_place&page=$next'>Next ></a> | <a href='$file_place&page=$jumlahhalaman'>Last >></a>";
	} else {
		echo "Next > | Last >>";
	}
	echo"<tr><td colspan='2'>&nbsp</tr>";
	echo"</table></td></tr>";
	

	
}

?>